define(function(require){
	var $=require("jq");
	var Dialog=require("pz_use_dialog.js");
	
	function _alert(msg){
		var tips=new Dialog({
			  type:"confirm",
			  text:"系统提示",
			  tipsText:msg,
			  buttonSureText:"知道了", 
			  buttonCancelText:"关闭", 
			  callBack:function(){         //回调函数
			  },
			  cancelCallBack:function(){
			  },
			  mask:0.8,
			  isDrag:true                //开起拖动
		});
	}
	
	$('#integrationExtSubmit').bind('click',function(event){
		var changeAmount = $('#integration').val();
		var targetLoginId = $('#targetLoginId').val();
		if(changeAmount == '' || changeAmount == null){
			_alert('请输入您要转出的礼券金额');
			return;
		}
		if(changeAmount <= 0){
			_alert('请输入正确的数字');
			return;
		}
  		var param = {};
  		param['amount'] = changeAmount;
  		param['targetLoginId'] = targetLoginId;
  		
  		$.getJSON("/vipCenter/userPointExtTransfer.do",param,function(result){
  			var success = result.success;
  			var message = result.msg;
  			if(!success){
  				var tips=new Dialog({
    				  type:"alert",
    				  text:"系统提示",
    				  tipsText:message,
    				  buttonCancelText:"关闭", 
    				  mask:0.8,
    				  isDrag:true                //开起拖动
				});
  			}else if(success == 1){
  				var tips=new Dialog({
  				  type:"alert",
  				  text:"系统提示",
  				  tipsText:message,
  				  buttonCancelText:"关闭", 
  				  mask:0.8,
  				  isDrag:true                //开起拖动
				});
  			}
  		});
	});
});